/*
 *  Copyright 2009 David Kuhn <david.s.kuhn at gmail.com>.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *  under the License.
 */

package com.google.code.teamtools.client;

import com.google.code.teamtools.client.service.TeamService;
import com.google.code.teamtools.client.service.TeamServiceAsync;
import com.extjs.gxt.ui.client.GXT;
import com.extjs.gxt.ui.client.Registry;
import com.extjs.gxt.ui.client.mvc.Dispatcher;
import com.google.code.teamtools.client.i18n.AppTextConstants;
import com.google.code.teamtools.client.controller.AppController;
import com.google.code.teamtools.client.controller.ContactController;
import com.google.code.teamtools.client.controller.TeamController;
import com.google.code.teamtools.client.controller.TaskController;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 *
 * @author David Kuhn
 */
public class TeamTools implements EntryPoint
{
    private final TeamServiceAsync mailService = GWT.create(TeamService.class);
    private final AppTextConstants appText = GWT.create(AppTextConstants.class);

    /**
     * This is the entry point method.
     */
    public void onModuleLoad()
    {
        Registry.register(RegistryKeys.TEAM_SERVICE, mailService);
        Registry.register(RegistryKeys.APP_TEXT, appText);

        Dispatcher dispatcher = Dispatcher.get();
        dispatcher.addController(new AppController());
        dispatcher.addController(new TeamController());
        dispatcher.addController(new TaskController());
        dispatcher.addController(new ContactController());

        dispatcher.dispatch(AppEvents.Login);

        GXT.hideLoadingPanel("loading");
    }
}
